package com.tnr.scgcxx;

import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.context.annotation.Bean;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;


@SpringBootApplication
@EnableCaching
@MapperScan({"com.tnr.scgcxx.dao","com.tnr.scgcxx.shiro.dao"})
public class ScgcxxApplication {

	
	public static void main(String[] args) {
		SpringApplication.run(ScgcxxApplication.class, args);
	}
	
	@Bean//跨域支持
	public WebMvcConfigurer corsConfigurer() {
		return new WebMvcConfigurer() {
			@Override
			public void addCorsMappings(CorsRegistry registry) {
				registry.addMapping("/**")
						.allowedMethods("*")
						.allowCredentials(true);//允许跨域session
			}
		};
	}

}
